-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add frontend hook #187
Add frontend hook #187
Conversation
src/hooks/use-user.tsx
Outdated
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import React, { ReactElement, useState, useEffect, useContext, createContext } from 'react'; | ||
|
||
declare const fetch: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add lib: ['dom']
to the tsconfig, then you wont need to declare fetch https://github.com/auth0/auth0-react/blob/master/tsconfig.json#L4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you may need to add something to eslint https://github.com/vercel/next.js/blob/canary/examples/with-typescript-eslint-jest/.eslintrc.json#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "browser": true
to eslint config. BTW, the fetch polyfill comes bundled with Next.js 9.4.0+. Currently the SDK requires 9.3.6. If we're going to keep that minimum version, we need to use node-fetch
or similar here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with 9.4 for min version
lgtm 👍 just a couple of TS things We can look at the failing tests later |
Description
This PR adds a frontend hook to fetch the User Profile from the React side of the app. The sample apps have been updated to use the provided hook.
Testing
Checklist
master